﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BuXiaChu.OrderDishes.BLL.CookieManager;

namespace BuXiaChu.OrderDishes.Web.CallCenter
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            p_Message.InnerHtml = "欢迎登录CC后台";
            if (IsPostBack)
            {
                LoginResultEnum result = AdminCookieManager.SignIn(txt_LoginName.Value, txt_Password.Value);
                if (result == LoginResultEnum.Success)
                {
                    if (string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]) == false)
                    {
                        Response.Redirect(Request.QueryString["ReturnUrl"], false);
                        return;
                    }
                    Response.Redirect("Index.aspx", false);
                }
                else
                {
                    p_Message.InnerHtml = "登录失败";
                    p_Message.Visible = true;
                }
            }
        }
    }
}
